import request from '@/config/axios'

// 车辆维保 VO
export interface VehiclesMaintenanceVO {
  id: number // 序号
  workNo: string // 作业单号
  receiveTime: Date // 接车日期
  checkoutTime: Date // 收银日期
  carNo: string // 车牌号
  carBrand: string // 厂牌
  carModel: string // 车形
  maintenanceCategory: string // 维修类别
  faultPhenomenon: string // 故障现象
  repairItems: string // 维修项目
  repairPrice: number // 维修费
  accessoryPrice: number // 配件费
  totalPrice: number // 工料合计
  alarmContent: string // 告警内容
}

// 车辆维保 API
export const VehiclesMaintenanceApi = {
  // 查询车辆维保分页
  getVehiclesMaintenancePage: async (params: any) => {
    return await request.get({ url: `/pplan/vehicles-maintenance/page`, params })
  },

  // 查询车辆维保详情
  getVehiclesMaintenance: async (id: number) => {
    return await request.get({ url: `/pplan/vehicles-maintenance/get?id=` + id })
  },

  // 新增车辆维保
  createVehiclesMaintenance: async (data: VehiclesMaintenanceVO) => {
    return await request.post({ url: `/pplan/vehicles-maintenance/create`, data })
  },

  // 修改车辆维保
  updateVehiclesMaintenance: async (data: VehiclesMaintenanceVO) => {
    return await request.put({ url: `/pplan/vehicles-maintenance/update`, data })
  },

  // 删除车辆维保
  deleteVehiclesMaintenance: async (id: number) => {
    return await request.delete({ url: `/pplan/vehicles-maintenance/delete?id=` + id })
  },

  // 导出车辆维保 Excel
  exportVehiclesMaintenance: async (params) => {
    return await request.download({ url: `/pplan/vehicles-maintenance/export-excel`, params })
  }
}